
export const useUserProfile = (UserProfile,modifyPlan,pageID) => {
    const setUserProfile = (profileKey, Profile) => {
        if ('IsUnfold' == profileKey)
          profileKey = UserProfile.UserDynamicKeys_unfolder;
  //@ts-ignore
        return window.Funcs.SetUserProfile({
          profileKey: { Key: UserProfile.UserProfileKey, DynamicKey: profileKey },
          profileValue: Profile,
        });
      };
      const setPageProfile = Profile => {
        //@ts-ignore
        return window.Funcs.SetPageUserProfile({
          profileKey: {
            Key: UserProfile.UserProfileKey,
            DynamicKey: UserProfile.PageDynamicKey.replace(
              /\$planId/gi,
              modifyPlan.value.ID,
            ),
          },
          PageID: pageID.value,
          profileValue: JSON.stringify(Profile),
        });
      };
      const getPageUserProfile = ()=>{
        //@ts-ignore
       return Funcs.GetPageUserProfile({
            profileKeys: {
              Key: UserProfile.UserProfileKey,
              DynamicKey: UserProfile.PageDynamicKey.replace(
                /\$planId/gi,
                modifyPlan.value.ID,
              ),
            },
            PageID: pageID.value,
          })
      }
      const getUserProfile = (keys:Array<any>)=>{
        //@ts-ignore
        return Funcs.GetUserProfile(keys)
      }
      return {
        setUserProfile,
        setPageProfile,
        getPageUserProfile,
        getUserProfile
      }
}